package com.ruoyi.web.controller.rgpp;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.rgpp.domain.JmrzpjyzdCompany;
import com.ruoyi.rgpp.service.IJmrzpjyzdCompanyService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 企业招聘信息Controller
 * 
 * @author ruoyi
 * @date 2022-06-15
 */
@Controller
@RequestMapping("/rgpp/jmrzpjyzdcompany")
public class JmrzpjyzdCompanyController extends BaseController
{
    private String prefix = "rgpp/jmrzpjyzdcompany";

    @Autowired
    private IJmrzpjyzdCompanyService jmrzpjyzdCompanyService;

    @RequiresPermissions("rgpp:jmrzpjyzdcompany:view")
    @GetMapping()
    public String jmrzpjyzdcompany()
    {
        return prefix + "/jmrzpjyzdcompany";
    }

    /**
     * 查询企业招聘信息列表
     */
    @RequiresPermissions("rgpp:jmrzpjyzdcompany:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(JmrzpjyzdCompany jmrzpjyzdCompany)
    {
        startPage();
        List<JmrzpjyzdCompany> list = jmrzpjyzdCompanyService.selectJmrzpjyzdCompanyList(jmrzpjyzdCompany);
        return getDataTable(list);
    }

    /**
     * 导出企业招聘信息列表
     */
    @RequiresPermissions("rgpp:jmrzpjyzdcompany:export")
    @Log(title = "企业招聘信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(JmrzpjyzdCompany jmrzpjyzdCompany)
    {
        List<JmrzpjyzdCompany> list = jmrzpjyzdCompanyService.selectJmrzpjyzdCompanyList(jmrzpjyzdCompany);
        ExcelUtil<JmrzpjyzdCompany> util = new ExcelUtil<JmrzpjyzdCompany>(JmrzpjyzdCompany.class);
        return util.exportExcel(list, "企业招聘信息数据");
    }

    /**
     * 新增企业招聘信息
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存企业招聘信息
     */
    @RequiresPermissions("rgpp:jmrzpjyzdcompany:add")
    @Log(title = "企业招聘信息", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(JmrzpjyzdCompany jmrzpjyzdCompany)
    {
        return toAjax(jmrzpjyzdCompanyService.insertJmrzpjyzdCompany(jmrzpjyzdCompany));
    }

    /**
     * 修改企业招聘信息
     */
    @RequiresPermissions("rgpp:jmrzpjyzdcompany:edit")
    @GetMapping("/edit/{card}")
    public String edit(@PathVariable("card") String card, ModelMap mmap)
    {
        JmrzpjyzdCompany jmrzpjyzdCompany = jmrzpjyzdCompanyService.selectJmrzpjyzdCompanyByCard(card);
        mmap.put("jmrzpjyzdCompany", jmrzpjyzdCompany);
        return prefix + "/edit";
    }

    /**
     * 修改保存企业招聘信息
     */
    @RequiresPermissions("rgpp:jmrzpjyzdcompany:edit")
    @Log(title = "企业招聘信息", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(JmrzpjyzdCompany jmrzpjyzdCompany)
    {
        return toAjax(jmrzpjyzdCompanyService.updateJmrzpjyzdCompany(jmrzpjyzdCompany));
    }

    /**
     * 删除企业招聘信息
     */
    @RequiresPermissions("rgpp:jmrzpjyzdcompany:remove")
    @Log(title = "企业招聘信息", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(jmrzpjyzdCompanyService.deleteJmrzpjyzdCompanyByCards(ids));
    }
}
